/**
 *
 */
package summer.codegenerator.persistence.hibernate.base;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Set;

import summer.codegenerator.persistence.hibernate.base.tool.Pagination;
import summer.codegenerator.persistence.hibernate.base.tool.Sort;
import org.hibernate.criterion.Order;
import com.alibaba.fastjson.JSONObject;
import summer.codegenerator.persistence.hibernate.base.tool.WhereClause;

/**
 * @author James
 *
 */
public interface BaseDao<T> {
	
	Class<?> getPersistClass();

	void saveCheck(T t);

	T findById(Long id);

	T copyById(Long id);

	void save(T entity);

	void update(T entity);

	void delete(T entity);

	void delete(final Long entityId);

	List<T> list();

	List<T> list(WhereClause condition, Sort sort);

	List<T> list(WhereClause condition, Sort sort, Pagination pagination);

	Long countTotal(WhereClause condition);

	List<T> listByCriteria(JSONObject condition, List<Order> orders, Pagination pagination);

	Long countTotalByCriteria(JSONObject condition);

	void flush();

	void clear();

	void flushThenClear();
	
	List<T> dtos(List<T> sources);

	T dto(T source);
}
